$(function () {
    setAjaxLoading();
    var grid = $("#tt");
    initGrid(grid);
    btnQuery();
});


//查询
function btnQuery() {
    params.tableNameShow =  $("#tableNameShow").val();
    if (params.pageNo == "undefined" || params.pageNo == undefined) {
        params.pageNo = 1;
        params.page = 1;
        params.pageNumber = 1;
    }
    var grid = $("#tt");
    getPage(grid, params, url);
}


/*导入 Excel */
function btnImport() {

   var rows =  $('#tt').datagrid("getSelections");
    if (typeof (rows) == 'undefined' || rows == null || rows == "") {
        $.messager.alert("友情提醒", "请选择导入数据！", "info");
        return;
    }
    if(rows.length != 1){
        $.messager.alert("友情提醒", "只能选择一行进行导入！", "info");
        return;
    }

    var tableNames = rows[0].tableNames;
    var url = '/common/excelHandleIndex/excelHandleInit?tableNames=' + tableNames;

    var width = top.document.body.clientWidth;
    var height = top.document.body.clientHeight;
    layer.open({
        type: 2,
        title: ["导入", 'background: #38acff;'],
        shadeClose: false,
        shade: 0.3,
        area: [width * 0.87 + 'px', height * 0.87 + 'px'],
        content: url,
        maxmin: true
    });
}